/**
 * 
 */
package org.nanhill.commons.pattern.flow;

import java.util.Map;

/**
 * @author alin [xalinx at gmail dot com]
 * @date 2007-1-7
 */
public class DefaultActionContext implements ActionContext {
	private String eventId;

	private final Map<String, Object> requestMap;

	/**
	 * @param request
	 */
	public DefaultActionContext(Map<String, Object> requestMap) {
		this.requestMap = requestMap;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.nanhill.commons.pattern.flow.ActionContext#getInteger(java.lang.String)
	 */
	public int getInteger(String key) {
		return Integer.parseInt((String) this.requestMap.get(key));
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.nanhill.commons.pattern.flow.ActionContext#getIntegers(java.lang.String)
	 */
	public int[] getIntegers(String key) {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.nanhill.commons.pattern.flow.ActionContext#getLong(java.lang.String)
	 */
	public long getLong(String key) {
		// TODO Auto-generated method stub
		return 0;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.nanhill.commons.pattern.flow.ActionContext#getLongs(java.lang.String)
	 */
	public long[] getLongs(String key) {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.nanhill.commons.pattern.flow.ActionContext#getObject(java.lang.String)
	 */
	public Object getObject(String key) {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.nanhill.commons.pattern.flow.ActionContext#getObject(java.lang.Class,
	 *      java.lang.String)
	 */
	public <E> E getObject(Class<E> clz, String key) {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.nanhill.commons.pattern.flow.ActionContext#getObjects(java.lang.String)
	 */
	public Object getObjects(String key) {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.nanhill.commons.pattern.flow.ActionContext#getObjects(java.lang.Class,
	 *      java.lang.String)
	 */
	public <E> E[] getObjects(Class<E> clz, String key) {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.nanhill.commons.pattern.flow.ActionContext#getString(java.lang.String)
	 */
	public String getString(String key) {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.nanhill.commons.pattern.flow.ActionContext#getStrings(java.lang.String)
	 */
	public String[] getStrings(String key) {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.nanhill.commons.pattern.flow.ActionContext#setEventId(java.lang.String)
	 */
	public void setEventId(String eventId) {
		this.eventId = eventId;

	}

	public String getEventId() {
		return this.eventId;
	}

	public boolean getBoolean(String key) {
		return Boolean.parseBoolean((String) this.requestMap.get(key));
	}

}
